const utils = {
  toCamelCase(str, upperCaseFirst) {
    str = (str || '').toLowerCase().replace(/[-_](.)/g, (match, group1) => group1.toUpperCase());
    if (upperCaseFirst && str) {
      str = str.charAt(0).toUpperCase() + str.slice(1);
    }
    return str;
  },
  toSnakeCase(s) {
    return s.replace(/([A-Z0-9])/g, function ($1) { return '_' + $1.toLowerCase(); });
  },
};

export default utils;
